package com.newlink.building.common_base.http.tools

import com.newlink.building.common_base.http.Base_RetrofitHelper
import com.newlink.building.common_base.model.bean.Base_BaseBean
import io.reactivex.Observer
import io.reactivex.disposables.Disposable

/**
 * @Author: Jake
 * @Date: 2023-04-06
 * @Description:
 */
class Base_TokenUpdateUtils {

    fun update(userid: Long, token: String, showMsg: () -> Unit) {
        Base_RetrofitHelper.service.refreshToken(userid, token).subscribe(object : Observer<Base_BaseBean> {
            override fun onSubscribe(d: Disposable) {
            }

            override fun onNext(t: Base_BaseBean) {
                if (t.code == 200) {
                    showMsg.invoke()
                }
            }

            override fun onError(e: Throwable) {
            }

            override fun onComplete() {
            }

        })

    }
}